import openpyxl
from openpyxl.workbook import Workbook
from openpyxl.worksheet.worksheet import Worksheet


class Dofiles():
    def doExeRead(self,f,stname,sr,er,sc,ec):
        #openpyxl.Workbook()
        wk:Workbook=openpyxl.load_workbook(f)
        st:Worksheet=wk[stname]
        #s=st.values
        #指定读取部分内容
        s=st.iter_rows(sr,er,sc,ec,values_only=True)
        l=[i for i in s]
        #print(l)
        return l
        #print(wk)
    # def doExeWrite(self,f):
    #     #第一种：有文件
    #     wk: Workbook = openpyxl.load_workbook(f)
    #     st: Worksheet = wk["Sheet1"]

if __name__ == '__main__':
    df = Dofiles()
    f=r"D:\lius\pythonCode\homeWorkPro\datas\jisuan.xlsx"
    print(df.doExeRead(f,"Sheet1",2,8,2,5))